package com.xgq.drink.mapper;

import com.xgq.drink.entity.FavoriteBrand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xgq
 * @since 2025-03-02
 */
public interface FavoriteBrandMapper extends BaseMapper<FavoriteBrand> {
    @Select("SELECT COUNT(*) FROM favorite_brand WHERE user_id = #{userId} AND brand_id = #{brandId} AND is_del = 0")
    int selectCountByUserIdAndBrandId(Long userId, Long brandId);
    @Update("UPDATE favorite_brand SET is_del = 1 WHERE favorite_brand_id = #{favoriteBrandId} AND user_id = #{userId}")
    int logicDeleteByUserIdAndFavoriteBrandId(Long userId, Long favoriteBrandId);
}
